package com.pokermind.operator.engine;

import com.pokermind.model.dto.PokerAIResponse;

import java.util.Arrays;

/**
 * 数学兜底决策结果
 * 当AI超时时，基于数学分析的保守决策
 *
 * @author PokerMind Team
 */
public class MathFallbackDecision {

    private final String action;
    private final String size;
    private final String reason;
    private final double confidence;

    public MathFallbackDecision(String action, String size, String reason) {
        this(action, size, reason, 0.7);
    }

    public MathFallbackDecision(String action, String size, String reason, double confidence) {
        this.action = action;
        this.size = size;
        this.reason = reason;
        this.confidence = confidence;
    }

    public String getAction() {
        return action;
    }

    public String getSize() {
        return size;
    }

    public String getReason() {
        return reason;
    }

    public double getConfidence() {
        return confidence;
    }

    /**
     * 转换为AI响应格式
     */
    public PokerAIResponse toAIResponse() {
        PokerAIResponse response = new PokerAIResponse();
        response.setAction(action);
        response.setSize(size);
        // V3.4: 合并为单条理由
        response.setReasons(reason + " [Math Fallback]");
        return response;
    }

    @Override
    public String toString() {
        return String.format("MathFallback{action=%s, size=%s, reason='%s', confidence=%.2f}",
            action, size, reason, confidence);
    }
}


